package com.imooc.pan.server.modules.file.vo;

import com.imooc.pan.server.modules.file.entity.RPanUserFile;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Objects;

/**
 * @author hhb
 * @data 2024/6/14 10:55
 */
@Data
@ApiModel("文件面包屑列表返回实体")
public class BreadCurmbVO {
    @ApiModelProperty("文件id")
    private Long id;


    @ApiModelProperty("父文件夹id")
    private Long parentId;

    @ApiModelProperty("文件夹名称")
    private String name;

    /**
     * RPanUserFile转化为BreadCurmbVO方法
     * @param record
     * @return
     */
    public static BreadCurmbVO transfer(RPanUserFile record){
        BreadCurmbVO vo = new BreadCurmbVO();
        if(Objects.nonNull(record)){
            vo.setId(record.getFileId());
            vo.setParentId(record.getParentId());
            vo.setName(record.getFilename());
        }

        return vo;
    }
}
